try:
    n = int(input())
    for i in range(n):
        e = eval(input().replace('x', '*'))
        if e == 24:
            print("Yes",end=' ')
        else:
            print("No",end=' ')
except SyntaxError:
    print("ERROR")